package com.xiaoxin.yixinai._frame.base;

import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

public interface Constant {
	
	/**
	 * 公司管理员默认密码
	 */
	public static String COMPANY_ADMIN_DEFAULT_PASSWORD = "a123456";
	
	/**
	 * 平台用户默认密码
	 */
	public static final String PLATMANAGER_DEFAULT_PASSWORD = "123456";
	
	// 数据是否删除
	public static final int NOT_DELETED = 0;
	public static final int DELETED = 1;

	/**
	 * 1.SIM卡 2.sip线路
	 */
	public static Integer SIMCARD = 1;
	public static Integer SIPLlINE = 2;
	
	/**
	 * 操作类型 1： "购买"
	 *	     2："使用"
	 */
	public static Integer BUY=1;
	public static Integer USE=2;
	
	/**
	 * 通道使用状态： 0：停用 1.启用
	 */
	public static Integer CHANNELDISABLE=0;
	public static Integer CHANNELENABLE=1;

	
	/**
	 * 运营平台用户状态(100表示启用,200表示禁用)
	 */
	public static Integer PLAT_MANAGER_STATUS_ENABLE = 100;
	public static Integer PLAT_MANAGER_STATUS_DISABLE = 200;
	
	/**
	 * 用户状态,是否允许登陆(0表示允许,1表示禁用)
	 */
	public static Integer USER_STATUS_ENABLE = 0;
	public static Integer USER_STATUS_DISABLE = 1;
	
	/**
     * 获得工单父类型
     * @return
     */
	public static Map<String, String> workFormParentTypeMap() {
		Map<String, String> map = new LinkedHashMap<String, String>();
		map.put("SIP", "SIP线路");
		map.put("SIM", "SIM卡");
		map.put("SPE", "话术");
		map.put("FUN", "功能开通");
		map.put("ELSE", "其他");
		return map;
	}
	
	/**
	 * 获得工单子类型
	 * @return
	 */
	public static Map<String, String> workFormSubTypeMap() {
		Map<String, String> map = new LinkedHashMap<String, String>();
		map.put("SIPA",  "*新开户");
		map.put("SIP_ADD_LINE",  "*增加线路");
		map.put("SIP_ADD_CONCURRENT",  "*增加并发");
		map.put("SIPC",  "变更");
		map.put("SIP_ASSIGN_CALL",  "分配主叫号码");
		map.put("SIP_DEDUCTION_CONCURRENT",  "降低并发");
		map.put("SIMA",  "*新开户");
		map.put("SIM_ADD_LINE",  "*增加线路");
		map.put("SIMC",  "变更");
		map.put("SPEA",  "新增");
		map.put("SPEC",  "变更");
		map.put("FUN_BREAK",  "*打断");
		map.put("FUN_SMS",  "短信");
		map.put("FUN_TURN_MAN",  "转人工");
		map.put("ELSE_ASSIGN_ACCOUNT",  "分账号");
		map.put("ELSE_MERGE_ACCOUNT",  "合并账号");
		map.put("ELSE_MOVE_SERVER",  "迁移服务器");
		map.put("ELSE_DEPLOY_SERVER",  "部署服务器");
		map.put("ELSE",  "其他");
		return map;
	}
	
	/**
     * 获得工单类型(格式： 父类型-子类型)
     * @return
     */
	public static Map<String, String> workFormMergeTypeMap() {
		Map<String, String> parentTypeMap = workFormParentTypeMap();
		Map<String, String> subTypeMap = workFormSubTypeMap();
		
		Set<String> parentTypeSet = parentTypeMap.keySet();
		
		Iterator<Entry<String, String>> iterator = subTypeMap.entrySet().iterator();
		while (iterator.hasNext()) {
			Entry<String, String> entry = iterator.next();
			String key = entry.getKey();
			for (String parentType: parentTypeSet) {
				if (key.startsWith(parentType)) {
					entry.setValue(String.format("%s-%s", parentTypeMap.get(parentType).toString(), entry.getValue()));
				}
			}
		}
		return subTypeMap;
	}
	
	/**
     * 获得工单计费/结算方式
     * @return
     */
	public static Map<String, String> workFormClearingFormMap() {
		Map<String, String> map = new LinkedHashMap<String, String>();
		map.put("1", "按年");
		map.put("2", "按半年");
		map.put("3", "按季");
		map.put("4", "按月");
		map.put("5", "试用");
		map.put("7", "其他");
		map.put("6", "不计费");
		return map;
	}
	
	/**
     * 获得反馈父类型
     * @return
     */
	public static Map<String, String> feedBackParentTypeMap() {
		Map<String, String> map = new LinkedHashMap<String, String>();
		map.put("CALL", "呼叫异常");
		map.put("ROBOT", "机器人通话");
		map.put("TASK", "任务");
		map.put("RECORD", "录音");
		map.put("FUNCTION", "功能");
		return map;
	}
	
	/**
	 * 获得反馈子类型
	 * @return
	 */
	public static Map<String, String> feedBackSubTypeMap() {
		Map<String, String> map = new LinkedHashMap<String, String>();
		map.put("CALL_OUT",  "呼不出去");
		map.put("CALL_SLOW",  "呼叫慢");
		map.put("CALL_THROUGH_RATE_LOW",  "接通率低");
		map.put("CALL_VOLUME_LOW",  "呼叫量低");
		map.put("CALL_OTHER",  "其他");
		
		map.put("ROBOT_ABNORMAL_SPEECH",  "机器人说话异常");
		map.put("ROBOT_QUALITY_PROBLEM",  "通话质量问题");
		map.put("ROBOT_VOICE_ERROR",  "声音识别错误");
		map.put("ROBOT_RECORD_ERROR",  "录音错误");
		map.put("ROBOT_ANSWER_ASKED",  "答非所问");
		map.put("ROBOT_OTHER",  "其他");
		
		map.put("TASK_CALL_EXCEPTION",  "任务拨打异常");
		map.put("TASK_ABNORMAL_END",  "异常自动结束");
		map.put("TASK_REPEATED_CALL",  "号码重复拨打");
		map.put("TASK_PAUSE_CALL",  "暂停仍呼叫");
		map.put("TASK_CANNOT_PAUSED",  "任务无法暂停");
		map.put("TASK_F_CLASS_MUCH",  "F类过多");
		map.put("TASK_OTHER",  "其他");
		
		map.put("RECORD_DOESNT_WORK",  "录音听不了");
		map.put("RECORD_OUT_SYNC",  "录音无法同步");
		map.put("RECORD_SYN_FAILURE",  "录音同步失败");
		map.put("RECORD_OTHER",  "其他");
		
		map.put("FUNCTION_ACCOUNT_PROBLEM",  "子账号问题");
		map.put("FUNCTION_CALL_VOLUME_ERROR",  "呼叫量显示错误");
		map.put("FUNCTION_BACKGROUND_PROBLEM",  "后台问题");
		map.put("FUNCTION_ACCOUNT_PROBLEM",  "子账号问题");
		map.put("FUNCTION_WECHAT_PUSH_EX",  "微信推送异常");
		map.put("FUNCTION_OTHER",  "其他");
		return map;
	}
	
	/**
     * 获得反馈类型(格式： 父类型-子类型)
     * @return
     */
	public static Map<String, String> feedBackMergeTypeMap() {
		Map<String, String> parentTypeMap = feedBackParentTypeMap();
		Map<String, String> subTypeMap = feedBackSubTypeMap();
		
		Set<String> parentTypeSet = parentTypeMap.keySet();
		
		Iterator<Entry<String, String>> iterator = subTypeMap.entrySet().iterator();
		while (iterator.hasNext()) {
			Entry<String, String> entry = iterator.next();
			String key = entry.getKey();
			for (String parentType: parentTypeSet) {
				if (key.substring(0,key.indexOf('_')).equals(parentType)) {
					entry.setValue(String.format("%s-%s", parentTypeMap.get(parentType).toString(), entry.getValue()));
				}
			}
		}
		return subTypeMap;
	}
	
	/**
	 * 工单状态(100处理中；200结束；300撤销)
	 */
	public static Integer WORK_STATUS_DEAL = 100;
	public static Integer WORK_STATUS_END = 200;
	public static Integer WORK_STATUS_REVOKE = 300;
	
	/**
	 * 反馈状态(100处理中；200结束；300撤销)
	 */
	public static Integer FEEDBACK_STATUS_DEAL = 100;
	public static Integer FEEDBACK_STATUS_END = 200;
	public static Integer FEEDBACK_STATUS_REVOKE = 300;
	
	/**
	 * 反馈记录状态(100未接受；200未完成，300已完成)
	 */
	public static Integer FEEDBACK_RECORD_STATUS_NO_RECEIVE = 100;
	public static Integer FEEDBACK_RECORD_STATUS_NO_COMPLETE = 200;
	public static Integer FEEDBACK_RECORD_STATUS_COMPLETE = 300;
	
	/**
	 * 获取反馈状态Map
	 * @return
	 */
	public static Map<String,String> getFeedBackStatus(){
		Map<String,String> workFormStatus = new LinkedHashMap<String, String>();
		workFormStatus.put(Constant.FEEDBACK_STATUS_DEAL.toString(), "处理中");
		workFormStatus.put(Constant.FEEDBACK_STATUS_END.toString(), "已结束");
		workFormStatus.put(Constant.FEEDBACK_STATUS_REVOKE.toString(), "已撤销");
		return workFormStatus;
	}
	
	/**
	 * 获取工单状态Map
	 * @return
	 */
	public static Map<String,String> getWorkFormStatus(){
		Map<String,String> workFormStatus = new LinkedHashMap<String, String>();
		workFormStatus.put(Constant.WORK_STATUS_DEAL.toString(), "处理中");
		workFormStatus.put(Constant.WORK_STATUS_END.toString(), "已结束");
		workFormStatus.put(Constant.WORK_STATUS_REVOKE.toString(), "已撤销");
		return workFormStatus;
	}
	
	/**
	 * 工单记录状态(100未接受；200未完成，300已完成)
	 */
	public static Integer WORK_RECORD_STATUS_NO_RECEIVE = 100;
	public static Integer WORK_RECORD_STATUS_NO_COMPLETE = 200;
	public static Integer WORK_RECORD_STATUS_COMPLETE = 300;
	
	public static String YYYYMMDDHHMMSS="yyyyMMddHHmmss";
	public static String YYYYMMDD="yyyyMMdd";
	
	/**
	 * 进度(1:提交资料,2:确认资料,3:开户,11:账务审核,4:话术文案,5:录音, 12:剪辑,6:可视化上线 ,7：配卡/线路 ,8:验收上线,9:结束,10:撤销)
	 */
	public static Integer SUBMINT_DATA = 1;
	public static Integer CONFIRM_DATA = 2;
	public static Integer OPEN_ACCOUNT = 3;
	public static Integer TECHINQUE_COPY = 4;
	public static Integer THE_VOICE = 5;
	public static Integer VISUAL_ON_LINE = 6;
	public static Integer WITH_THE_CARD = 7;
	public static Integer ACCEPTANCE_ONLINE = 8;
	public static Integer END = 9;
	public static Integer REVOKE = 10;
	public static Integer ACCOUNT_AUDIT = 11;
	public static Integer CUTING_RECORD = 12;
	
	/**
	 * 反馈进度(1:提交资料,2:确认资料,3:处理中,4:完成,5:结束,6:撤销)
	 */
	public static Integer FEEDBACK_SUBMINT_DATA = 1;
	public static Integer FEEDBACK_CONFIRM_DATA = 2;
	public static Integer FEEDBACK_PROCESSING = 3;
	public static Integer FEEDBACK_COMPLETE = 4;
	public static Integer FEEDBACK_END = 5;
	public static Integer FEEDBACK_REVOKE = 6;
	
	/**
	 * 获得反馈tag Map
	 * @return
	 */
	public static Map<String,String> getFeedbackTagMap(){
		Map<String,String> map = new LinkedHashMap<String,String>(); 
		map.put(Constant.FEEDBACK_SUBMINT_DATA.toString(), "提交");
		map.put(Constant.FEEDBACK_CONFIRM_DATA.toString(), "确认");
		map.put(Constant.FEEDBACK_PROCESSING.toString(), "处理中");
		map.put(Constant.FEEDBACK_COMPLETE.toString(), "完成");
		map.put(Constant.FEEDBACK_END.toString(), "结束");
		map.put(Constant.FEEDBACK_REVOKE.toString(), "已撤销");
		return map;
	}
	
	/**
	 * 角色常量
	 */
	public static String THE_AGENT = "AGENT";
	public static String ACCOUNT_MANAGER = "ACCOUNT_MANAGER";
	public static String ADMINISTRATOR = "ADMIN";
	
	/**
	 * 获得tag Map
	 * @return
	 */
	public static Map<String,String> getTagMap() {
		Map<String,String> map = new LinkedHashMap<String, String>(); 
		map.put(Constant.SUBMINT_DATA.toString(), "提交资料");
		map.put(Constant.CONFIRM_DATA.toString(), "确认资料");
		map.put(Constant.ACCOUNT_AUDIT.toString(), "账务审核");
		map.put(Constant.OPEN_ACCOUNT.toString(), "开户");
		map.put(Constant.TECHINQUE_COPY.toString(), "话术文案");
		map.put(Constant.THE_VOICE.toString(), "录音");
		map.put(Constant.CUTING_RECORD.toString(), "剪辑");
		map.put(Constant.VISUAL_ON_LINE.toString(), "可视化上线");
		map.put(Constant.WITH_THE_CARD.toString(), "配卡/线路");
		map.put(Constant.ACCEPTANCE_ONLINE.toString(), "验收上线");
		map.put(Constant.END.toString(), "结束");
		map.put(Constant.REVOKE.toString(), "撤销");
		return map;
	}
	
	/**
	 * 行业类型 1.金融 2.房产 3.服务业 4.汽车销售 5.互联网 6.餐饮 7.保险 8.电商 9.增值电信 10.家装 11.教育 12.代理商 13.其他行业
	 */
	public static Integer FINANCE=1;
	public static Integer HOUSEPROPERTY=2;
	public static Integer SERVICEINDUSTRY=3;
	public static Integer CARSALES=4;
	public static Integer INTERNET=5;
	public static Integer RESTAURANT=6;
	public static Integer INSURANCE=7;
	public static Integer ONLINERETAILERS=8;
	public static Integer TELECOM=9;
	public static Integer HOMEDECORATION=10;
	public static Integer EDUCATION=11;
	public static Integer AGENT=12;
	public static Integer OTHER=13;
	
	/**
	 * 客户级别：（0：一般客户；1：重点客户；2：核心客户；）
	 */
	public static Integer GENERAL_CUSTOMER = 0;
	public static Integer FOCUS_CUSTOMER = 1;
	public static Integer CORE_CUSTOMER = 2;
	
	/**
	 * 行业类型 map(这个和其他项目中一块统一一下，看是用数据字典还是用...)
	 * @return
	 */
	public static Map<String,String> getIndustryMap(){
		Map<String,String> map = new LinkedHashMap<String,String>(); 
		map.put(Constant.FINANCE.toString(), "金融");
		map.put(Constant.HOUSEPROPERTY.toString(), "房产");
		map.put(Constant.SERVICEINDUSTRY.toString(), "服务业");
		map.put(Constant.CARSALES.toString(), "汽车销售");
		map.put(Constant.INTERNET.toString(), "互联网");
		map.put(Constant.RESTAURANT.toString(), "餐饮");
		map.put(Constant.INSURANCE.toString(), "保险");
		map.put(Constant.ONLINERETAILERS.toString(), "电商");
		map.put(Constant.TELECOM.toString(), "增值电信");
		map.put(Constant.HOMEDECORATION.toString(), "家装");
		map.put(Constant.EDUCATION.toString(), "教育");
		map.put(Constant.AGENT.toString(), "代理商");
		map.put(Constant.OTHER.toString(), "其他行业");
		return map;
	}
	
	
	/**
	 * 操作类型
	 * @return
	 */
	public static Map<String,String> getActionType(){
		Map<String,String> map =new LinkedHashMap<String,String>();
		map.put(Constant.BUY.toString(), "购买");
		map.put(Constant.USE.toString(), "使用");
		return map;
	}
	
	/**
	 * 通道类型
	 * @return
	 */
	public static Map<String,String> getChannelTypeMap(){
		Map<String,String> map =new LinkedHashMap<String,String>();
		map.put(Constant.SIMCARD.toString(), "SIM卡");
		map.put(Constant.SIPLlINE.toString(), "SIP线路");
		return map;
	}
	
	/**
	 * 客户级别
	 * @return
	 */
	public static Map<Integer,String> getCustomerLevel(){
		Map<Integer,String> map =new LinkedHashMap<Integer,String>();
		map.put(Constant.GENERAL_CUSTOMER, "一般客户");
		map.put(Constant.FOCUS_CUSTOMER, "重点客户");
		map.put(Constant.CORE_CUSTOMER, "核心客户");
		return map;
	}
	

	/**
	 * 通道类型
	 * @return
	 */
	public static Map<String,String> getChannelStateMap(){
		Map<String,String> map =new LinkedHashMap<String,String>();
		map.put(Constant.CHANNELDISABLE.toString(), "停用");
		map.put(Constant.CHANNELENABLE.toString(), "启用");
		return map;
	}

//	//菜单状态 1 显示
//	public static Integer MENU_STATUS=1;
//
//	public static Integer MENU_USER_DEFAULT=-1;
//s上级提成比例
	public static String ORDER_COMMISSION_RATE_PARENT="0.15";
	//上上级提成比例
	public static String ORDER_COMMISSION_RATE_GRAND="0.05";
}
